/*
class: Circle
Purpose:  This class extends the point class by using it
		to determine the center point of a circle.  Notice
		how the variables and methods of the point class are
		inherited?
		i'm also using TurtleGraphics which is a package I
		downloaded from a University.You will find the TurtleGraphics
		folder on the moodle site in resources.
		It must be included in the same file as the Circle
		class.

*/
import TurtleGraphics.*;

public class Circle extends point 
{
	// A Circle will be defined by the radius and center
	private int radius;
	private point center = new point();
	
	//Constructors
	public Circle()
	{
		super();//This sets up the point
	}
	
	public Circle(int r, point p)
	{
		center = p; // sets up the point with the 3rd constructor
		radius = r;
		
		
	}
	
	public Circle(int r, int xCoord, int yCoord)
	{
			center.setX(xCoord);
			center.setY(yCoord);
			radius = r;		
	}
	
	
	//Method: SetRadius
	// this method will allow the program using it to set the
	// radius.
	public void SetRadius(int r)
	{
		radius = (r >= 0 ? radius : 0);
	}
	
	
	//Method: getRadius
	// this method will allow the program using it to get the
	// radius.
	public int getRadius()
	{
		return radius;
	}
	
	//This method will return the area of the radius
	public double area()
	{
		return Math.PI*radius*radius;
	
	}
	
	//This method will alow me to move the center of the
	// circle.
	public void move(point p)
	{
		// moving the center of the circle
		center.setX(p.getX());
		center.setY(p.getY());
		
			
	}
	

	//This method uses a pen from the TurtleGraphics package
	// and I can draw the circle.
	public void draw(Pen p)
	{
		double part = 2*Math.PI*radius/120;
		p.setDirection(90);
		p.down();
		for(int i = 0; i<120; i++)
		{
			p.move(part);
			p.turn(3);
		
		}
		
	}
	
	//This method prints out the circle in terms of its center
	// and radius.
	public String toString()
	{
		return "Center: " + center + "\nRadius: " + radius;
	
	}
	

}


/*
1.  What are the ways in which I can enstantiate a circle?

2.  Why must I use the keyword extends to 'extend' point?

3.  Write a method called Circumference that will find
    the circumference of a circle.
	 
4.  What does this line of code do:
		radius = (r >= 0 ? radius : 0);
(you can always test it by putting in various radius's in the 
test program!!)

5.  Which methods in this program are polymorphic


*/